package com.ruoyi.system.dao;

import java.util.List;

import com.ruoyi.common.core.domain.entity.SysDictType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.ruoyi.common.core.domain.entity.SysDictData;

@Repository
public interface SysDictDataDAO extends JpaSpecificationExecutor<SysDictData>, JpaRepository<SysDictData, Long> {

	public List<SysDictData> findByDictType(String dictType);

	public List<SysDictData> findByDictTypeIn(String[] dictTypes);

	@Modifying
	@Query(value = "update sys_dict_data set dict_type=?2 where dict_type =?1", nativeQuery = true)
	public int updateDictDataType(String oldDictType, String newDictType);

	@Query(value ="select dict_label from sys_dict_data where dict_type =?1 and dict_value =?2 ", nativeQuery = true)
	public String selectDictLabel(String dictType, String dictValue);




}
